package com.gupaoedu.springboot.springbootstarterdemo.jmxDemo;

import javax.management.*;
import java.io.IOException;
import java.lang.management.ManagementFactory;

/**
 * <p>
 *
 * </p>
 *
 * @author Nicky
 * @since 2019-07-13
 */
public class JMXMain {

    public static void main(String[] args) throws MalformedObjectNameException, NotCompliantMBeanException, InstanceAlreadyExistsException, MBeanRegistrationException, IOException {
        MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
        ObjectName objectName = new ObjectName("com.gupaoedu.springboot.springbootstarterdemo.jmxDemo.MechineMBean:type=Mechine");
        MechineMBean mechinMBean = new Mechine();
        mBeanServer.registerMBean(mechinMBean,objectName);
        System.in.read();
    }

}
